<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>流水查询</title>
    <style>
        :root {
            --primary-color: #165DFF;
            --secondary-color: #4080FF;
            --accent-color: #FF7D00;
            --text-color: #333333;
            --light-text: #666666;
            --bg-color: #F5F7FA;
            --card-bg: #FFFFFF;
            --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
            --border-radius: 12px;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Inter', sans-serif;
        }

        body {
            background-color: var(--bg-color);
            background-image: 
                radial-gradient(circle at 25% 25%, rgba(22, 93, 255, 0.03) 0%, transparent 50%),
                radial-gradient(circle at 75% 75%, rgba(22, 93, 255, 0.03) 0%, transparent 50%);
            background-attachment: fixed;
            min-height: 100vh;
            color: var(--text-color);
        }

        .header {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            padding: 20px 40px;
            background: rgba(255, 255, 255, 0.8);
            backdrop-filter: blur(10px);
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
            z-index: 10;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .logo {
            font-size: 24px;
            font-weight: 700;
            color: var(--primary-color);
            display: flex;
            align-items: center;
        }

        .logo i {
            margin-right: 10px;
            color: var(--accent-color);
        }

        .button {
            background-color: var(--primary-color);
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: var(--border-radius);
            cursor: pointer;
            text-decoration: none;
            transition: all 0.3s ease;
            margin-right: 15px;
            display: inline-flex;
            align-items: center;
        }

        .button:hover {
            background-color: var(--secondary-color);
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(22, 93, 255, 0.2);
        }

        .button i {
            margin-right: 5px;
        }

        .logout-button {
            background-color: #FF0000;
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: var(--border-radius);
            cursor: pointer;
            text-decoration: none;
            transition: all 0.3s ease;
            display: inline-flex;
            align-items: center;
        }

        .logout-button:hover {
            background-color: #CC0000;
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(204, 0, 0, 0.2);
        }

        .logout-button i {
            margin-right: 5px;
        }

        .nav-buttons {
            display: flex;
            align-items: center;
        }

        .container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 120px 40px 40px;
        }

        .profile-name {
            font-size: 28px;
            font-weight: 700;
            margin-bottom: 30px;
            color: var(--primary-color);
        }

        .card-container {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
            gap: 30px;
        }

        .card {
            background: var(--card-bg);
            border-radius: var(--border-radius);
            box-shadow: 0 8px 30px rgba(22, 93, 255, 0.15);
            padding: 30px;
            transition: all 0.3s ease;
            border: 1px solid rgba(22, 93, 255, 0.1);
            position: relative;
            overflow: hidden;
        }

        .card::before {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 6px;
            background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
        }

        .card:hover {
            transform: translateY(-8px);
            box-shadow: 0 12px 40px rgba(22, 93, 255, 0.2);
        }

        .card-info {
            margin-bottom: 20px;
        }

        .card-item {
            display: flex;
            align-items: center;
            margin-bottom: 15px;
        }

        .card-label {
            color: var(--light-text);
            width: 80px;
            font-size: 14px;
        }

        .card-value {
            font-size: 16px;
            font-weight: 500;
        }

        .card-value.hidden {
            color: #999;
        }

        .input-group {
            display: flex;
            gap: 10px;
            margin-top: 20px;
        }

        .password-input {
            flex: 1;
            padding: 10px 15px;
            border: 1px solid #E0E3E9;
            border-radius: var(--border-radius);
            font-size: 16px;
            transition: all 0.3s ease;
        }

        .password-input:focus {
            outline: none;
            border-color: var(--primary-color);
            box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.2);
        }

        .password-input.shake {
            animation: shake 0.5s;
        }

        @keyframes shake {
            0%, 100% { transform: translateX(0); }
            10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
            20%, 40%, 60%, 80% { transform: translateX(5px); }
        }

        .verify-button {
            background-color: var(--primary-color);
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: var(--border-radius);
            cursor: pointer;
            font-size: 16px;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .verify-button:hover {
            background-color: var(--secondary-color);
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(22, 93, 255, 0.2);
        }

        .verify-button i {
            margin-right: 5px;
        }

        .action-button {
            display: inline-block;
            background-color: var(--primary-color);
            color: white;
            border: none;
            padding: 12px 24px;
            border-radius: var(--border-radius);
            cursor: pointer;
            text-decoration: none;
            font-size: 16px;
            transition: all 0.3s ease;
            margin-top: 30px;
        }

        .action-button:hover {
            background-color: var(--secondary-color);
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(22, 93, 255, 0.2);
        }

        .action-button i {
            margin-right: 5px;
        }

        .footer {
            text-align: center;
            padding: 20px;
            color: var(--light-text);
            font-size: 14px;
            margin-top: 60px;
        }

        .flow-table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
        }

        .flow-table th,
        .flow-table td {
            padding: 10px;
            border: 1px solid #E0E3E9;
            text-align: left;
        }

        .flow-table th {
            background-color: var(--bg-color);
        }
    </style>
    <link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <script>
        function validatePassword(cardIndex, correctPassword) {
            const input = document.getElementById(`password-${cardIndex}`);
            const enteredPassword = input.value;

            const cardIdElement = document.getElementById(`card-id-${cardIndex}`);
            const flowTableElement = document.getElementById(`flow-table-${cardIndex}`);
            const verifyButton = document.getElementById(`verify-button-${cardIndex}`);

            if (enteredPassword === correctPassword) {
                // 显示完整卡号
                cardIdElement.textContent = cardIdElement.dataset.full;
                cardIdElement.classList.remove('hidden');

                // 显示流水信息
                flowTableElement.style.display = 'table';

                // 更改按钮样式
                verifyButton.innerHTML = '<i class="fa fa-check"></i> 验证成功';
                verifyButton.style.backgroundColor = '#00B42A';
                input.disabled = true;
            } else {
                // 错误提示
                cardIdElement.textContent = '验证失败';
                cardIdElement.classList.add('hidden');
                flowTableElement.style.display = 'none';

                // 震动效果
                input.classList.add('shake');
                setTimeout(() => input.classList.remove('shake'), 500);
            }
        }
    </script>
</head>
<body>
    <!-- 顶部导航 -->
    <div class="header">
        <div class="logo">
            <i class="fa fa-bank"></i>
            安心银行
        </div>
        <div class="nav-buttons">
            <a href="/personal" class="button">
                <i class="fa fa-user-circle"></i> 个人中心
            </a>
            <a href="/" class="logout-button">
                <i class="fa fa-sign-out"></i> 退出登录
            </a>
        </div>
    </div>

    <!-- 主要内容 -->
    <div class="container">
        <div class="profile-name">欢迎 {{ user.name }}</div>
        <h2>账户流水查询</h2>

        <div class="card-container">
            {% for card in user.card_info %}
                <div class="card">
                    <div class="card-info">
                        <div class="card-item">
                            <div class="card-label">卡号：</div>
                            <div class="card-value hidden" id="card-id-{{ loop.index0 }}" data-full="{{ card.cardID }}">************{{ card.cardID[-4:] }}</div>
                        </div>
                    </div>

                    <div class="input-group">
                        <input type="password" id="password-{{ loop.index0 }}" placeholder="输入密码查看完整信息" class="password-input">
                        <button id="verify-button-{{ loop.index0 }}" class="verify-button" onclick="validatePassword({{ loop.index0 }}, '{{ card.pass }}')">
                            <i class="fa fa-lock"></i> 验证密码
                        </button>
                    </div>

                    <table class="flow-table" id="flow-table-{{ loop.index0 }}" style="display: none;">
                        <thead>
                            <tr>
                                <th>交易日期</th>
                                <th>交易类型</th>
                                <th>交易金额</th>
                                <th>备注</th>
                            </tr>
                        </thead>
                        <tbody>
                            {% for flow in user.trade_flow_info[card.cardID] %}
                                <tr>
                                    <td>{{ flow.tradeDate }}</td>
                                    <td>{{ flow.tradeType }}</td>
                                    <td>{{ flow.tradeMoney }}</td>
                                    <td>{{ flow.remark }}</td>
                                </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                </div>
            {% endfor %}
        </div>
    </div>

    <!-- 页脚 -->
    <div class="footer">
        © 2025 安心银行 
    </div>
</body>
</html>